package examples;

import com4j.Variant;
import wps.ClassFactory;
import wps.WdAlertLevel;
import wps.WdExportCreateBookmarks;
import wps.WdExportFormat;
import wps.WdExportItem;
import wps.WdExportOptimizeFor;
import wps.WdExportRange;
import wps._Application;
import wps._Document;

public class WpsSaveAsPdf {

	public static void main(String[] args) {
		_Application app = ClassFactory.createApplication();
		app.visible(false);
		app.displayAlerts(WdAlertLevel.wdAlertsNone);
		
		String filename = "C:\\Users\\Arvin Yuan\\Desktop\\云签章异步接口问题.docx";
		boolean readonly = true;

		_Document doc = app.documents().open(filename, readonly, Variant.getMissing(), Variant.getMissing(), 
				Variant.getMissing(), Variant.getMissing(), Variant.getMissing(), Variant.getMissing(), Variant.getMissing(), 
				Variant.getMissing(), Variant.getMissing(), Variant.getMissing(), Variant.getMissing(), Variant.getMissing(),
				Variant.getMissing(), Variant.getMissing());
		
		String outfileName = "C:\\\\Users\\\\Arvin Yuan\\\\Desktop\\\\云签章异步接口问题.pdf";
		String fileFormat = "pdf";
		
		doc.exportAsFixedFormat(outfileName, WdExportFormat.wdExportFormatPDF, false, WdExportOptimizeFor.wdExportOptimizeForPrint,
				WdExportRange.wdExportAllDocument, 1, 1, WdExportItem.wdExportDocumentContent, false,
				false, WdExportCreateBookmarks.wdExportCreateNoBookmarks, false, false, false,
				Variant.getMissing());
		
		doc.close(Variant.getMissing(), Variant.getMissing(), Variant.getMissing());
		
		app.quit(Variant.getMissing(), Variant.getMissing(), Variant.getMissing());
	}

}
